package charTest;

import org.junit.Test;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

/**
 * 对一个字符串
 * key是字符
 * value是个数
 */
public class test {
    @Test
    public  void test(){
        String  s = "sdfsfses";
        Map<Character,Integer> a = new HashMap<Character,Integer>();

        System.out.println(a.containsKey("s"));
        char[] chars = s.toCharArray();
        for(int i = 0;i<chars.length;i++){
            System.out.println(!a.containsKey(chars[i]));
            if(!a.containsKey(chars[i])){
                a.put(chars[i],0);
            }else{
                a.put(chars[i],Integer.valueOf(a.get(chars[i]))+1);
            }
        }
        Set<Character> set = a.keySet();
        for(Character ss : set){
            System.out.println(ss+"------------"+a.get(ss));
        }
        for (Character key : a.keySet()) {
            System.out.println("key= "+ key + " and value= " + a.get(key));
        }

    }

    public static void main(String[] args) {
        String ss = "ssssssssssssssssssss";
        ss = null;
        System.out.printf(ss.length()+"");
    }
}
